Skip to content

FEDX-5172: Detect build readiness from webdev stdout#67

Merged
btr-rmconsole-2[bot] merged 3 commits intomasterfrom
dart3_detect_ready_deterministic
Apr 1, 2026
Merged

FEDX-5172: Detect build readiness from webdev stdout#67
btr-rmconsole-2[bot] merged 3 commits intomasterfrom
dart3_detect_ready_deterministic

Conversation

@evanweible-wf
Copy link
Copy Markdown
Contributor

@evanweible-wf evanweible-wf commented Apr 1, 2026

Problem

With Dart 3 and newer webdev/build_runner versions, a line that the build/serve process previously emitted — which consumers used to detect readiness — is no longer output. This broke scripts in consumer repos that monitor for a readiness signal in webdev_proxy's output.

Solution

build_runner reliably emits one of the following lines to webdev's stdout when the initial build finishes, regardless of verbose mode:

  • Built with build_runner/jit in Xs; wrote N outputs.
  • Failed to build with build_runner/jit in Xs; wrote N outputs.

This PR switches WebdevServer to ProcessStartMode.normal to capture webdev's stdout, watches that stream for the build-complete signal, then emits [INFO] Succeeded after N seconds on its own line — preserving compatibility with existing consumer scripts already monitoring for that string.

Changes

  • WebdevServer uses ProcessStartMode.normal and exposes a stdoutLines broadcast stream; stderr is forwarded to the parent process unchanged
  • ServeCommand listens to stdoutLines to forward webdev output to the user and waits for the build-complete pattern before emitting the readiness signal
  • Adds test/webdev_ready_detection_test.dart with two tests: one verifying WebdevServer.stdoutLines emits the build-complete signal before the HTTP server is responsive, and one verifying ServeCommand emits 'Succeeded after' in its output

Known tradeoff

ProcessStartMode.normal causes webdev to detect a pipe rather than a TTY, changing its progress output from \r-based in-place rewrites to newline-separated lines. This is spammier for large projects during the initial build. Feedback welcome on whether this tradeoff is acceptable.

Test plan

  • dart test test/webdev_ready_detection_test.dart — verifies the build-complete signal appears in WebdevServer.stdoutLines and that ServeCommand emits 'Succeeded after'
  • dart test test/webdev_server_test.dart — existing serve test still passes
  • Manually run dart pub global activate -sgit https://github.com/Workiva/webdev_proxy.git --git-ref dart3_detect_ready_deterministic in a consumer project and confirm [INFO] Succeeded after N seconds is emitted after the initial build

@evanweible-wf evanweible-wf force-pushed the dart3_detect_ready_deterministic branch 2 times, most recently from d8ceb6a to 672fb6d Compare April 1, 2026 16:42
@btr-rmconsole-5 btr-rmconsole-5 bot changed the title Detect build readiness from webdev stdout FEDX-5172 Detect build readiness from webdev stdout Apr 1, 2026
@bender-wk bender-wk changed the title FEDX-5172 Detect build readiness from webdev stdout FEDX-5172: Detect build readiness from webdev stdout Apr 1, 2026
@evanweible-wf evanweible-wf marked this pull request as ready for review April 1, 2026 16:43
@evanweible-wf evanweible-wf requested a review from a team as a code owner April 1, 2026 16:43
@evanweible-wf evanweible-wf force-pushed the dart3_detect_ready_deterministic branch from 672fb6d to cd17980 Compare April 1, 2026 17:45
Switches WebdevServer from ProcessStartMode.inheritStdio to
ProcessStartMode.normal so that webdev stdout can be monitored.
Exposes a stdoutLines broadcast stream on WebdevServer; stderr
continues to be forwarded to the parent process.

ServeCommand listens to stdoutLines, forwarding each line to
stdout and watching for build_runner's completion signal
('Built with build_runner' / 'Failed to build with build_runner').
Once detected, it emits '[INFO] Succeeded after N seconds' on its
own line.

Also adds a test verifying the build-complete signal appears in
webdev stdout before the HTTP server becomes responsive.
@evanweible-wf evanweible-wf force-pushed the dart3_detect_ready_deterministic branch from cd17980 to f45658e Compare April 1, 2026 20:33
@robbecker-wf robbecker-wf mentioned this pull request Apr 1, 2026
SDK constraint is now >=3.0.0 so there is no need to test against 2.19.6.
Both workflows default to 2.19.6 if sdk is not specified; explicitly
pass stable to keep CI on Dart 3.
@robbecker-wf
Copy link
Copy Markdown
Member

QA +1 CI passes on Dart stable. Internal testing shows existing scripts work.

@robbecker-wf
Copy link
Copy Markdown
Member

@Workiva/release-management-p

Copy link
Copy Markdown

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from RM

@btr-rmconsole-2 btr-rmconsole-2 bot merged commit 8f78ed7 into master Apr 1, 2026
11 checks passed
@btr-rmconsole-2 btr-rmconsole-2 bot deleted the dart3_detect_ready_deterministic branch April 1, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants